import request from '@/utils/request'
import qs from 'qs'

// 查询出入库管理列表
export function listInoutmanage(query) {
  return request({
    url: '/itemmanage/inoutmanage/list',
    method: 'get',
    params: query
  })
}

// 查询出入库管理详细
export function getInoutmanage(id) {
  return request({
    url: '/itemmanage/inoutmanage/' + id,
    method: 'get'
  })
}

// 新增出入库管理
export function addInoutmanage(data) {
  return request({
    url: '/itemmanage/inoutmanage',
    method: 'post',
    data: data
  })
}

// 修改出入库管理
export function updateInoutmanage(data) {
  return request({
    url: '/itemmanage/inoutmanage',
    method: 'put',
    data: data
  })
}

// 删除出入库管理
export function delInoutmanage(id) {
  return request({
    url: '/itemmanage/inoutmanage/' + id,
    method: 'delete'
  })
}

// 删除出入库管理
/*export function changeStatus(data) {
  return request({
    url: `/itemmanage/inoutmanage/changeStatus/`,
    method: 'put',
    data: data
  })
}*/

export function changeStatus(ids,storeId,type) {
  let params = {ids, storeId,type}
  let formParams = qs.stringify(params, {indices: false});

  return request({

    url: `/itemmanage/inoutmanage/changeStatus`,
    data: formParams,
    headers: {'content-type': 'application/x-www-form-urlencoded'}, // 表单参
    method: 'put',
  })
}



export function selectBill(id,storeId) {
  let params = {id, storeId}
  // let formParams = qs.stringify(params, {indices: false});
  return request({
    url: `/itemmanage/inoutmanage/selectBill`,
    params: params,
    headers: {'content-type': 'application/x-www-form-urlencoded'}, // 表单参
    method: 'get',
  })
}

export function getGoodsRekord(id) {
  return request({
    url: '/itemmanage/inoutmanage/goodsRekord',
    method: 'get',
    params: id
  })
}
